import { SceneGame } from "../../SceneGame";
import ItemRender from "./ItemRender";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ItemTeaRender extends ItemRender {
    
    @property({ type: cc.Node, tooltip: "锁定节点" })
    private lockNode: cc.Node = null;

    @property({ type: cc.Node, tooltip: "已获得节点" })
    private obtainNode: cc.Node = null;

    @property({ type: cc.Sprite, tooltip: "头像" })
    private icon: cc.Sprite = null;

    @property({ type: cc.Label, tooltip: "名字" })
    private title: cc.Label = null;

    @property({ type: cc.Label, tooltip: "描述" })
    private desc: cc.Label = null;

    @property({type: cc.Label, tooltip: "花费金币"})
    private cost: cc.Label = null;

    @property({ type: cc.Node, tooltip: "解锁方式" })
    private normal_nodes: cc.Node = null;

    @property({ type: cc.Node, tooltip: "解锁方式" })
    private develop_nodes: cc.Node = null;

    @property({ type: cc.Node, tooltip: "解锁方式" })
    private sale_nodes: cc.Node = null;

    /**数据改变时调用 */
    public dataChanged() {
        // const info = this.data as ITeaInfo;
        // // 0.未解锁  1.已解锁
        // const level = info.unlock_level;
        // this.lockNode.active = level === ETeaStatus.Lock;
        // this.obtainNode.active = level === ETeaStatus.Unlock;
        // this.cost.string = `${GameUtil.changeUnit(info.unlock_gold, 2)}`;
        // this.title.string = `LV.${info.goods_id} ${info.goods_name}`;
        // this.desc.string = level === ETeaStatus.Lock ? "尚未解锁，赶快解锁赚钱吧~" : info.goods_desc;
        // this.icon.spriteFrame = GameUtil.instance.getSpriteFrameByType(EResType.Tea, info.goods_id);
    }

    private onSelfBtnClicked(event: cc.Event.EventTouch, eventData: string) {
        // GlobalData.curTeaInfo = this.data;
        SceneGame.instance.showPopView('PanelTeaInfo', null);
    }
}